#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
float epsilon = 0.01;
int main()
{
    double n = 99.0;
    /*
    double i = 0;
    for(i = 0; i < n; i = i + 0.001)
    {
            double temp = fabs(i*i -n);
            cout<<i<<":"<<temp<<endl;
            if(temp < epsilon)
                break;
            
    }
    */
    double min = 0.0,max = n;
    double temp;
    double i;
    do
    {
           i = (max + min)/2.0;
           
           temp = i*i -n;
           if(temp>0)
             max = i;
           if(temp<0)
             min = i;
           
           cout<<i<<":"<<temp<<endl;
           
    }while(fabs(temp)>epsilon);
    cout<<"sqrt("<<n<<") = "<<fixed<<setprecision(2)<<i<<endl;
    getchar();
}
